<?php

use Illuminate\Support\Facades\Schema;
use Illuminate\Database\Schema\Blueprint;
use Illuminate\Database\Migrations\Migration;

class CreateRoundsTable extends Migration
{
    /**
     * Run the migrations.
     *
     * @return void
     */
    public function up()
    {
        Schema::create('rounds', function (Blueprint $table) {
            $table->increments('id');
            $table->string('name')->comment('轮次名称');
            $table->integer('activity_id')->comment('活动ID');
            $table->timestamp('start_time')->nullable()->comment('开始时间');
            $table->timestamp('end_time')->nullable()->comment('结束时间');
            $table->string('sponsor')->nullable()->comment('主办方');
            $table->text('description')->nullable()->comment('引导词');
            $table->string('title')->nullable()->comment('红包标题');
            $table->enum('type', ['random', 'fixed'])->comment('红包类型 random随机红包 fixed固定金额红包');
            $table->float('money_total', 6, 2)->nullable()->comment('发放总金额(随机红包时)');
            $table->float('probability', 3, 2)->comment('概率%');
            $table->float('single_money', 6, 2)->nullable()->comment('单个红包(固定金额时)');
            $table->integer('number')->comment('发放总个数');
            $table->tinyInteger('state');
            $table->softDeletes();
            $table->timestamps();
        });
    }

    /**
     * Reverse the migrations.
     *
     * @return void
     */
    public function down()
    {
        Schema::dropIfExists('rounds');
    }
}
